home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sprite 1984 - 1993
/
Sprite 1984 - 1993.iso
/
src
/
lib
/
c
/
time
/
RCS
/
times.c,v
< prev
next >
Wrap
Text File
|
1989-08-20
|
2KB
|
106 lines
head 1.3;
branch ;
access ;
symbols ;
locks ; strict;
comment @ * @;
1.3
date 89.08.20.19.36.02; author rab; state Exp;
branches ;
next 1.2;
1.2
date 89.08.20.19.31.14; author rab; state Exp;
branches ;
next 1.1;
1.1
date 88.07.22.15.50.48; author ouster; state Exp;
branches ;
next ;
desc
@Re-organize so gcc doesn't complain about redeclaration.
@
1.3
log
@Included <sys/types.h>
@
text
@/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@@(#)times.c 5.2 (Berkeley) 3/9/86";
#endif /* LIBC_SCCS and not lint */
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <sys/times.h>
static
scale60(tvp)
register struct timeval *tvp;
{
return (tvp->tv_sec * 60 + tvp->tv_usec / 16667);
}
times(tmsp)
register struct tms *tmsp;
{
struct rusage ru;
if (getrusage(RUSAGE_SELF, &ru) < 0)
return (-1);
tmsp->tms_utime = scale60(&ru.ru_utime);
tmsp->tms_stime = scale60(&ru.ru_stime);
if (getrusage(RUSAGE_CHILDREN, &ru) < 0)
return (-1);
tmsp->tms_cutime = scale60(&ru.ru_utime);
tmsp->tms_cstime = scale60(&ru.ru_stime);
return (0);
}
@
1.2
log
@Deleted structure and included <sys/times.h> instead.
@
text
@d9 1
a9 1
#endif LIBC_SCCS and not lint
d13 1
@
1.1
log
@Initial revision
@
text
@d13 1
a13 10
/*
* Backwards compatible times.
*/
struct tms {
int tms_utime; /* user time */
int tms_stime; /* system time */
int tms_cutime; /* user time, children */
int tms_cstime; /* system time, children */
};
@